﻿using System;
using System.Collections.Generic;
using System.Text;

namespace HR.Appointments.Service.FacadeUsers
{
    /// <summary>
    /// Class for owners of the system.
    /// </summary>
    public class Owner
    {
        #region Constructors
        /// <summary>
        /// Initializes a new owner class
        /// </summary>
        public Owner()
        {
        }
        #endregion

        #region Get Methods
        /// <summary>
        /// Get an instance of a comany
        /// </summary>
        /// <param name="companyId">Company identifier</param>
        /// <returns>A company entity</returns>
        public CompanyEntity GetCompany(int companyId)
        {
            return DAO.Instance.Company.GetInstance(companyId);
        }

        /// <summary>
        /// Get all companies in database which have not been deleted
        /// </summary>
        /// <returns>A list of companies</returns>
        public List<CompanyEntity> GetAllCompanyCompanies()
        {
            return DAO.Instance.Company.GetAll();
        }
        #endregion

        #region Delete Methods
        /// <summary>
        /// Delete a specific company from database
        /// </summary>
        /// <param name="companyId">Company identifier</param>
        public void DeleteCompany(int companyId)
        {
            try
            {
                DAO.Instance.Company.Delete(companyId);
            }
            catch (System.Data.SqlClient.SqlException ex)
            {
                throw new SubmitException("Delete activity failed", ex);
            }
        }
        #endregion
    }
}
